<template>
    <div :class="computedClass">
        <div class="messageToogle"></div>
        <div class="content" v-html="chat.message"></div>
    </div>
</template>
<script lang="ts" setup>
import { computed, inject } from 'vue'
const chat = inject('chat', {})
const align = inject('align', 'left')
const computedClass = computed(()=> ['messageTextWrapper', align == 'right' ? 'right' : ''])
</script>
<style lang="less" scoped>
.messageTextWrapper {
  display: flex;
  width: 70%;
  &.right {
    flex-direction: row-reverse;
      .messageToogle {
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 8px 8px 8px 8px; /* 左侧边框宽度决定三角大小 */
        border-color: transparent transparent transparent #6fe648; /* 左侧边框颜色与消息背景色相同 */
        position: relative;
        top: 9px;
      }
      .content {
        background-color: #6fe648;
      }
  }
  .messageToogle {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 8px 8px 0; /* 右侧边框宽度决定三角大小 */
    border-color: transparent white transparent transparent;
    position: relative;
    top: 9px;
    filter: drop-shadow(-2px 2px 4px #ececec);
    //box-shadow: -2px 2px 4px #ececec;
  }
  .content {
    background-color: white;
    padding: 7px 10px;
    border-radius: 3px;
    font-size: 13.5px;
    //filter: drop-shadow(2px 0px 10px #f1f1f1);
    box-shadow: 2px 2px 4px #ececec;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    max-width: 70%;
    font-size: 14px;
  }
}
</style>